Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLANET-7714 Fix Sentry errors #2490

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sagarsdeshmukh
Copy link
Member

@sagarsdeshmukh sagarsdeshmukh commented Dec 31, 2024

Ref. https://jira.greenpeace.org/browse/PLANET-7714

Summary

Fix below type errors

Sentry error

TypeError
P4\MasterTheme\GravityFormsExtensions::p4_client_side_gravityforms_prefill(): Argument #1 ($form) must be of type array, bool given, called in /app/source/public/wp-includes/class-wp-hook.php on line 326

Sentry Error

TypeError
P4\MasterTheme\Migrations\Utils\Functions::create_media_text_block(): Argument #3 ($img_url) must be of type string, bool given, called in /app/source/vendor/themes/planet4-master-theme/src/Migrations/M032MigrateSplit2ColumnBlock.php on line 114

planet-4 added a commit to greenpeace/planet4-test-proteus that referenced this pull request Dec 31, 2024
/unhold 4343ccaf-2729-45a7-be4d-46e370db320d
@planet-4
Copy link
Contributor

planet-4 commented Dec 31, 2024

Test instance is ready 🚀

🌑 proteus | admin | blocks report | CircleCI | composer-local.json

⌚ 2025.01.01 05:26:04

planet-4 added a commit to greenpeace/planet4-test-proteus that referenced this pull request Jan 1, 2025
/unhold 9da77d7e-741e-401d-aec4-f6632ebcba94
planet-4 added a commit to greenpeace/planet4-test-proteus that referenced this pull request Jan 1, 2025
/unhold 760a45ae-f36c-410d-b215-f8f8689227bf
@sagarsdeshmukh sagarsdeshmukh force-pushed the PLANET-7714-Sentry-errors branch from 4dbe0d2 to 4d35adf Compare January 1, 2025 05:17
@sagarsdeshmukh sagarsdeshmukh marked this pull request as ready for review January 1, 2025 05:18
@sagarsdeshmukh sagarsdeshmukh self-assigned this Jan 1, 2025
@sagarsdeshmukh sagarsdeshmukh requested review from a team, mardelnet, GP-Dan-Tovbein and Osong-Michael and removed request for a team January 1, 2025 05:18
@sagarsdeshmukh sagarsdeshmukh changed the title PLANET-7714 Fix GF function type error PLANET-7714 Fix Sentry errors Jan 1, 2025
planet-4 added a commit to greenpeace/planet4-test-proteus that referenced this pull request Jan 1, 2025
/unhold 6059dba8-77c9-4deb-ae53-fd34e3a20cd6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to modify a migration script that was already run?


if ($redirect_id) {
if ($redirect_page) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, double-check that this is working as expected.
I've done something similar here, which caused some trouble as you can see here.

Comment on lines +417 to +419
return $item !== null
&& $nav_menu_item !== null
&& $item->menu_item_parent === $nav_menu_item->menu_item_parent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it simpler?

Suggested change
return $item !== null
&& $nav_menu_item !== null
&& $item->menu_item_parent === $nav_menu_item->menu_item_parent;
return $item && $nav_menu_item && $item->menu_item_parent === $nav_menu_item->menu_item_parent;

@@ -435,7 +437,7 @@ function render_navigation_block(array $attributes): string
// For child pages, only show link to the parent
if ($submenu_page->menu_item_parent !== 0) {
$parent_item = array_filter($menu_items, function ($item) use ($submenu_page) {
return (int) $item->ID === (int) $submenu_page->menu_item_parent;
return $submenu_page !== null && (int) $item->ID === (int) $submenu_page->menu_item_parent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
return $submenu_page !== null && (int) $item->ID === (int) $submenu_page->menu_item_parent;
return $item && $submenu_page && (int) $item->ID === (int) $submenu_page->menu_item_parent;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants